<div class="alert alert-success"><span class="glyphicon glyphicon-info-sign"></span> 用户发送的消息不含关键词的自动回复</div>
<form action="" class="form-horizontal" role="form">
	<div class="form-group">
	    <label class="col-sm-2 control-label">自动回复类型</label>
	    <div class="col-sm-2">
	    	<select class="form-control" id="type-select" name="type" datatype="*">{$helpReply.type}</select>
	    </div>
	</div>
	
	<!-- 文本 -->
	<div class="form-group" id="type-text">
		<label class="col-sm-2 control-label">自动回复内容</label>
		<div class="col-sm-4">
			<textarea class="form-control" name="text" rows="5" id="txtContent">{$helpReply.text}</textarea>
		</div>
	</div>
	
	
	<!-- 图文 -->
	<div class="form-group" id="type-news">
		<label class="col-sm-2 control-label">自动回复内容</label>
		<div class="col-sm-5">
			<div id="news-result">
				<ul class="news-edit-lists">
				</ul>
			</div>
		</div>
	</div>
	
	<div class="form-group">
		<div class="col-sm-offset-2 col-sm-8">
			<input type="hidden" name="id" value="{$helpReply.id}"/>
			<input type="hidden" name="news" id="news-id" value="" />
			<button type="submit" class="btn btn-primary submit" data-loading-txt="提交中，请稍后……" data-ajax-url="__CONTROLLER__/anythingPost">保存更改</button>
		</div>
	</div>
</form>

<!-- 图文素材列表 -->
<section id="news">
	<ul class="news-lists" id="news-lists"></ul>
</section>

<script type="text/javascript">
	var news_data = {$newsJSON};
</script>
<script type="text/javascript" src="__PUBLIC__/Style/My/Default/js/getNewsLists.js"></script>
<script type="text/javascript">
$(function() {
	//初始化（设置文本还是图文显示）
	var type = $("#type-select option:selected").val(),
		pNum = 1,
		oText = $("#type-text"), 
		oNews = $("#type-news"), 
		oResult = $("#news-result ul"),
		news = $("#news"),
		selectId = {};
	
	if(type == "text"){
		oNews.hide();
		oText.show();
	}else if(type == "news"){
		oText.hide();
		oNews.show();
		oResult.show();
		news.show();
		$MoveTools.init({'listUrl': "__CONTROLLER__/getNewsListPost/p/"});
	}
	
	//选择文化或者图文时
	$("#type-select").on("change", function(){
		var sel = $(this).val();
		if(sel == "text"){
			//图文隐藏，文本显示
			oNews.hide();
			oText.show();
			news.hide();
			$("#news-lists").html("");
		}else if(sel == "news"){
			//文本隐藏，图文显示
			oText.hide();
			oNews.show();
			oResult.show();
			news.show();
			$MoveTools.init({'listUrl': "__CONTROLLER__/getNewsListPost/p/"});
		}
	});
});
</script>
